Speeding up this site

This website has been really slow for some time. It’s been doing my head in. The mysql server has been particularly flaky. I ran the front page through Google’s PageSpeed Insights tool, to see what it said. It ran by default for mobile devices. The news wasn’t good – mostly red numbers and lots of advice.

None of the advice made much sense to me, and I didn’t think a lot of the advice was possible to follow for WordPress sites without editing the theme. So I decided to do what I could: I focused on the images (I already use a caching plugin, so there was no need to do anything about that).

Image compression

Two of the plugins I already have do image optimisation, but I knew of another one, so I gave that a go, and smushed all but two of the images; the two images refused to be smushed – one because it didn’t seem to exist, but I don’t know what was wrong with the other one. With Smush installed, a notice appeared in the WordPress admin area telling that it was interfering with two other tools that improve image performance, so before smushing, I disabled their image-processing facilities.

After Smush had smushed all images it was going to smush, I uninstalled it. It had a premium feature to convert images from JPEG, PNG and GIF format to WebP, which is a modern image format that provides superior lossless and lossy compression for images on the web. Using WebP, webmasters and web developers can create smaller, richer images that make the web faster [1]. I thought I’d look for a plugin that would do this for free, while not generating messages about clashes with other plugins. I found WebP Converter for Media, which also converts files to the newer AVIF format, but at a premium.

WebP Converter for Media plugin

MySQL

These changes did seem to make a difference to the loading speed, but mysql was still keeling over every five minutes. The internet gave me a list of reasons why mysql on a Digital Ocean website might keep crashing [2]. The first reason, buggy code on Digital Ocean or WordPress was disheartening, although the mention of some plugins causing the crash rang true: the WebP conversion seemed to kill MySQL completely. Eventually, it finished, and MySQL revived for five minutes.

The second point suggested that there might not be enough resources – RAM – to run MySQL. I logged in to Digital Ocean, and had a look at the activity graphs; the memory was running at 97–100 %. Ouch. I noticed that I could double the memory at no extra cost, so I did that. Then I came back here and had found that it was running a little faster. The PageSpeed looks greener now, too.

It’s a lot less frustrating now to do simple tasks like refresh the page or save a draft post.

References

  1. Google Developers (21 January 2021) An image format for the Web, Google, https://developers.google.com/speed/webp/; accessed 12 February 2022.
  2. Sijin George (12 December 2018) Digitalocean – MySQL keeps crashing – Here’s how to fix it!, Bob Cares, https://bobcares.com/blog/digitalocean-mysql-keeps-crashing/; accessed 12 February 2022.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.